package com.qf.cloud2203.service2.controller;

import com.qf.cloud2203.domain.entity.Vote;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/service2")
public class Service2Controller {
    @RequestMapping("/home")
    public String home() {
        return "service2home";
    }

    @GetMapping("/findAll")
    public List<Vote> getVoteList() {
        ArrayList<Vote> votes = new ArrayList<>();
        Vote vote = new Vote();
        vote.setId(1);
        vote.setPhone("13588888888");
        votes.add(vote);
        return votes;
    }

    @PostMapping("/update")
    Vote updateVote(@RequestBody Vote vote) {
        vote.setVoteNum(100);
        return vote;
    }

    @DeleteMapping("service2/delete/{id}")
    Vote deleteVote(@PathVariable Integer id) {
        return null;
    }
}
